package com.wtb.javatool.service.impl;

import com.wtb.javatool.dao.TeamMapper;
import com.wtb.javatool.entity.Team;
import com.wtb.javatool.service.TeamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeamServiceImpl implements TeamService {
    @Autowired
    private TeamMapper teamMapper;


    @Override
    public void addTeam(Long classId, String teamName) {
        Team team = new Team();
        team.setTeamName(teamName);
        teamMapper.insertTeam(team);
        teamMapper.insertClassTeamRef(classId,team.getTeamId());
    }

    @Override
    public void deleteTeam(Long teamId) {
        teamMapper.deleteClassTeamRef(teamId);
    }

    @Override
    public void updateTeamLeader(Long teamId, Long userId) {
        teamMapper.updateTeamLeader(teamId,userId);
    }
}
